<?php echo $this->Form->create('Sprint',array('action'=>'search'));?>
<div id="search">
	<?php echo $html->link(__('Add New Sprint',true), array('controller'=> 'sprintPlans', 'action'=>'add'), array('class'=>'button')); ?>
</div>

<div class="list_header">
		<?php
			echo $this->Paginator->counter(array(
				'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
			));
		?>
		<div class="pages">
			<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>|
			<?php echo $this->Paginator->numbers();?>|
			<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?></div>
		</div>
		<div id="container" class="clearfix">
		<table border="0" cellpadding="5" cellspacing="0" width="100%">
			<tr class="title">
				<td><?php echo $this->Paginator->sort('Id','Sprint.id');?></td>
				<td><?php echo $this->Paginator->sort('Sprint Name','Sprint.name');?></td>
				<td><?php echo $this->Paginator->sort('Status');?></td>
				<td>Started Date</td>
				<td>End Date</td>
				<td>Working days</td>
				<td colspan="8"><span><?php __('Actions');?></span></td>
			</tr>
			<?php
	
	foreach ($sprints as $sprint):
	?>
	<tr>
		<td><?php echo $sprint['Sprint']['id']; ?>&nbsp;</td>
		<td><?php echo $sprint['Sprint']['name']; ?>&nbsp;</td>
		<td><?php echo ($sprint['Sprint']['status'] === 1)? 'Planed' : (($sprint['Sprint']['status'] === 2)?'Working':'Past'); ?>&nbsp;</td>
		<td><?php echo $sprint['Sprint']['startDate'];?>&nbsp;</td>
		<td><?php echo $sprint['Sprint']['endDate'];?></td>
		<td><?php echo $sprint['Sprint']['workingDays'];?></td>
		<td class="actions">
			<?php echo $this->Html->link(__('Add tasks', true), array('controller' => 'tasks', 'action' => 'addItem'));  ?>
			<?php echo $this->Html->link(__('Edit', true), array('controller' => 'tasks', 'action' => 'edit', $sprint['Sprint']['id'])); ?>
			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $sprint['Sprint']['id']), null, sprintf(__('Are you sure you want to delete %s?', true), $sprint['Sprint']['name'])); ?>
			<?php echo $this->Html->link(__('Detail', true), array('controller' => 'tasks', 'action' => 'viewDetail'));  ?>
		</td>
	</tr>
<?php endforeach; ?>
		</table>
		</div>